<?php
namespace admin\service;

/**--tmpl-use--**/
use herosphp\core\Loader;

/**--tmpl-import--**/

class OperationLogService extends CommonService{

    public function getItems($conditions, $fields, $order, $limit, $group, $having)
    {
        $items = parent::getItems($conditions, $fields, $order, $limit, $group, $having);
        if(!$items) return NULL;


        /**-- foreigncondi --**/
        $manager_managercondi = array();
        foreach($items as $k => $v)
        {
            if($v['manager_id'])
            {
                $manager_managercondi[] = $v['manager_id'];
            }
        }

        $adminDao = Loader::model('adminManager');
        $manager = $adminDao->getItems(array('id' => array('$in' => $manager_managercondi)));

        /**-- foreignforeach  --**/
        foreach ($items as $k => $v)
        {
            /**--tmpl-foreignfill--**/

            foreach($manager as $kk => $vv)
            {
                if($vv['id'] == $v['manager_id'])
                {
                    $items[$k]['manager_name'] = $vv['name'];
                }
            }

        }
        return $items;
    }
}

